package cn.yuanqiao.quartz.task;

import cn.yuanqiao.archive.wenjianzhengli.service.ITenantYqdaDocumentService;
import cn.yuanqiao.common.utils.DateUtils;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.quartz.util.MethodDescription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component("IdentifyTask")
public class IdentifyTask {

    private static final Logger log = LoggerFactory.getLogger(IdentifyTask.class);

    @Autowired
    private ITenantYqdaDocumentService yqdaDocumentService;


    @MethodDescription("识别转换定时任务，arg0需要传入tenantCode")
    public void task(String tenantCode,String categoryId)
    {
            if(StringUtils.isNotEmpty(tenantCode)){
                Date start = new Date();
                log.info("定时识别任务开始="+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,start));
                yqdaDocumentService.identifyTaskAll(tenantCode,categoryId);
                Date end = new Date();
                log.info("定时转换任务结束="+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,end));
                log.info("耗时="+(end.getTime()-start.getTime())+"毫秒");
            }else {
                log.error("TenantCode is null");
            }


    }
}
